U*IX Compatibility Routines

#include unistd.h>

void _exit(int ret); Exit the current process without cleaning up. (This is a Pterm())

int access(const char &sstarf#star;fname, int mode); Check, if file fname is accessable with mode mode.

int chdir(const char &sstarf#star;dname); Chane the current working directory to dname including drive specification.

int chmod(const char &sstarf#star;fname, int mode); Change permissions of file fname to mode.

int chown(const char &sstarf#star;fname, int uid, int gid); Change owner and group of file fname. (Fake for now)

int close(int fd); Close the file assosiated with file descriptor fd.

int creat(const char &sstarf#star;fname, unsigned mode); Create the file fname with mode mode.

int dup(int fd); Duplicate filedescriptor fd.

int dup2(int fd1, int fd2); Duplicate filedescriptor fd1 to fd2.

int execve(char &sstarf#star;path, char &sstarf#star;&sstarf#star;argv, char &sstarf#star;&sstarf#star;envp); int execv(char &sstarf#star;path, char &sstarf#star;&sstarf#star;argv); Execute a new process from path after a fork().

int fork(); int vfork(); Simulate a non multitasking fork. vfork shares data + stack with parent.

char &sstarf#star;getcwd(char &sstarf#star;buf, int size); char &sstarf#star;getwd(char &sstarf#star;buf); Get the current working directory.

int getgid(); int getuid(); Get user and group id's. (Fake for now, returning alsways root).

int getegid(); int geteuid(); Get effective user and group id's.

char &sstarf#star;getlogin(); Return the user's login name. (Password file and environment are seached in order).

int getopt(int argc, const char &sstarf#star;&sstarf#star;argv, const char &sstarf#star;opt); Extract the command line options described by opt from argv.

int getpgrp(); int setpgrp(); Get or create a process group (This basically a fake; both return getpid()).

int getpid(); Return a process id for the currently running process (from the basepage).

int getppid(); Get parent process id.

char &sstarf#star;initstate(unsigned seed, char &sstarf#star;arg_state, int n); Initialize state array of generator for random.

int isatty(int fd); Check, if fd is associated with a terminal (screen).

int kill(int, int);

int link(const char &sstarf#star;old , const char &sstarf#star;new); Make a new link from new to old. Always fails.

int symlink(char &sstarf#star;old , char &sstarf#star;new); Make a new symbolic link from new to old. Env. UNIXMODE determines behavior.

int readlink(char &sstarf#star;fname , char &sstarf#star;buf, int siz); Read the link for fname into buf.

long lseek(int fd, long pos, int whence); Set the current file posistion to position pos relative to whence.

int mkdir(const char &sstarf#star;dname); Make a directory with name dname.

char &sstarf#star;mktemp(char &sstarf#star;pattern); Return a filename for a temporary file, build after pattern.

int open(const char &sstarf#star;fname, int mode, …); Open the file fname with mode mode.

void psignal(int signal, const char &sstarf#star;prefix); Print a error message describing the signal with a user comment.

long random(); Return a pseudo random number in the range from 0 to 231 - 1.

int rmdir(const char &sstarf#star;dname); Remove the directory with name dname.

int read(int fd, void &sstarf#star;buf, int cnt); long lread(int fd, void &sstarf#star;buf, long cnt); Read cnt bytes from file descriptor fd into buffer buf.

void &sstarf#star;sbrk(size_t size); void &sstarf#star;lsbrk(long size); Emulation of the U&sstarf#star;ix sbrk() system call.

void setlinebuf(FILE &sstarf#star;fp); Change the buffering on stream fp from block/unbuffered to line buffered.

int setegid(int gid); int seteuid(int uid); Set the effective groud and user id.

char &sstarf#star;setstate(char &sstarf#star;arg_state); Switch state of generator for random.

int sleep(int n); Sleep for n number of seconds.

int srandom(unsigned int x); Seed generator for random.

int stime(long &sstarf#star;time); Set the current time to time in U&sstarf#star;ix format.

long tell(int fd); Get the current file position of the file associated with fd.

int times(struct tms &sstarf#star;buf); Get process times into buf.

int umask(int mode); Set access mask. (Fake for now)

int unlink(const char &sstarf#star;fname); Remove the file with name fname.

int usleep(long n); Sleep for n number of milliseconds.

int utime(const char &sstarf#star;fname, const struct utimbuf &sstarf#star;ftime); Set the modification time and date of file fname to ftime.

int write(int fd, const void &sstarf#star;buf, int cnt); long lwrite(int fd, const void &sstarf#star;buf, long cnt); Write cnt bytes from buffer buf to file descriptor fd.

int wait(int &sstarf#star;exit_code); Wait for child process.